3.4.6 \(\int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx\) [306]

3.4.6.1 Optimal result
3.4.6.2 Mathematica [A] (verified)
3.4.6.3 Rubi [A] (verified)
3.4.6.4 Maple [A] (verified)
3.4.6.5 Fricas [A] (verification not implemented)
3.4.6.6 Sympy [F]
3.4.6.7 Maxima [A] (verification not implemented)
3.4.6.8 Giac [B] (verification not implemented)
3.4.6.9 Mupad [B] (verification not implemented)

3.4.6.1 Optimal result

Integrand size = 31, antiderivative size = 209 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {1}{2} a^2 \left (a^2 A+12 A b^2+8 a b B\right ) x+\frac {b^2 \left (8 a A b+12 a^2 B+b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {a (5 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {a A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}-\frac {b \left (13 a^2 A b-2 A b^3+4 a^3 B-8 a b^2 B\right ) \tan (c+d x)}{2 d}-\frac {b^2 \left (6 a A b+2 a^2 B-b^2 B\right ) \sec (c+d x) \tan (c+d x)}{2 d} \]

output
1/2*a^2*(A*a^2+12*A*b^2+8*B*a*b)*x+1/2*b^2*(8*A*a*b+12*B*a^2+B*b^2)*arctan 
h(sin(d*x+c))/d+1/2*a*(5*A*b+2*B*a)*(a+b*sec(d*x+c))^2*sin(d*x+c)/d+1/2*a* 
A*cos(d*x+c)*(a+b*sec(d*x+c))^3*sin(d*x+c)/d-1/2*b*(13*A*a^2*b-2*A*b^3+4*B 
*a^3-8*B*a*b^2)*tan(d*x+c)/d-1/2*b^2*(6*A*a*b+2*B*a^2-B*b^2)*sec(d*x+c)*ta 
n(d*x+c)/d
 
3.4.6.2 Mathematica [A] (verified)

Time = 3.63 (sec) , antiderivative size = 310, normalized size of antiderivative = 1.48 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {2 a^2 \left (a^2 A+12 A b^2+8 a b B\right ) (c+d x)-2 b^2 \left (8 a A b+12 a^2 B+b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 b^2 \left (8 a A b+12 a^2 B+b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^4 B}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b^3 (A b+4 a B) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}-\frac {b^4 B}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b^3 (A b+4 a B) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+4 a^3 (4 A b+a B) \sin (c+d x)+a^4 A \sin (2 (c+d x))}{4 d} \]

input
Integrate[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x]),x]
 
output
(2*a^2*(a^2*A + 12*A*b^2 + 8*a*b*B)*(c + d*x) - 2*b^2*(8*a*A*b + 12*a^2*B 
+ b^2*B)*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + 2*b^2*(8*a*A*b + 12*a^ 
2*B + b^2*B)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + (b^4*B)/(Cos[(c + 
d*x)/2] - Sin[(c + d*x)/2])^2 + (4*b^3*(A*b + 4*a*B)*Sin[(c + d*x)/2])/(Co 
s[(c + d*x)/2] - Sin[(c + d*x)/2]) - (b^4*B)/(Cos[(c + d*x)/2] + Sin[(c + 
d*x)/2])^2 + (4*b^3*(A*b + 4*a*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] + Si 
n[(c + d*x)/2]) + 4*a^3*(4*A*b + a*B)*Sin[c + d*x] + a^4*A*Sin[2*(c + d*x) 
])/(4*d)
 
3.4.6.3 Rubi [A] (verified)

Time = 0.94 (sec) , antiderivative size = 208, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {3042, 4513, 25, 3042, 4582, 3042, 4536, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )^4 \left (A+B \csc \left (c+d x+\frac {\pi }{2}\right )\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 4513

\(\displaystyle \frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}-\frac {1}{2} \int -\cos (c+d x) (a+b \sec (c+d x))^2 \left (-2 b (a A-b B) \sec ^2(c+d x)+\left (A a^2+4 b B a+2 A b^2\right ) \sec (c+d x)+a (5 A b+2 a B)\right )dx\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {1}{2} \int \cos (c+d x) (a+b \sec (c+d x))^2 \left (-2 b (a A-b B) \sec ^2(c+d x)+\left (A a^2+4 b B a+2 A b^2\right ) \sec (c+d x)+a (5 A b+2 a B)\right )dx+\frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \int \frac {\left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (-2 b (a A-b B) \csc \left (c+d x+\frac {\pi }{2}\right )^2+\left (A a^2+4 b B a+2 A b^2\right ) \csc \left (c+d x+\frac {\pi }{2}\right )+a (5 A b+2 a B)\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx+\frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}\)

\(\Big \downarrow \) 4582

\(\displaystyle \frac {1}{2} \left (\int (a+b \sec (c+d x)) \left (-2 b \left (2 B a^2+6 A b a-b^2 B\right ) \sec ^2(c+d x)-b \left (A a^2-6 b B a-2 A b^2\right ) \sec (c+d x)+a \left (A a^2+8 b B a+12 A b^2\right )\right )dx+\frac {a (2 a B+5 A b) \sin (c+d x) (a+b \sec (c+d x))^2}{d}\right )+\frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \left (\int \left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right ) \left (-2 b \left (2 B a^2+6 A b a-b^2 B\right ) \csc \left (c+d x+\frac {\pi }{2}\right )^2-b \left (A a^2-6 b B a-2 A b^2\right ) \csc \left (c+d x+\frac {\pi }{2}\right )+a \left (A a^2+8 b B a+12 A b^2\right )\right )dx+\frac {a (2 a B+5 A b) \sin (c+d x) (a+b \sec (c+d x))^2}{d}\right )+\frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}\)

\(\Big \downarrow \) 4536

\(\displaystyle \frac {1}{2} \left (\frac {1}{2} \int \left (2 \left (A a^2+8 b B a+12 A b^2\right ) a^2-2 b \left (4 B a^3+13 A b a^2-8 b^2 B a-2 A b^3\right ) \sec ^2(c+d x)+2 b^2 \left (12 B a^2+8 A b a+b^2 B\right ) \sec (c+d x)\right )dx-\frac {b^2 \left (2 a^2 B+6 a A b-b^2 B\right ) \tan (c+d x) \sec (c+d x)}{d}+\frac {a (2 a B+5 A b) \sin (c+d x) (a+b \sec (c+d x))^2}{d}\right )+\frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {1}{2} \left (-\frac {b^2 \left (2 a^2 B+6 a A b-b^2 B\right ) \tan (c+d x) \sec (c+d x)}{d}+\frac {1}{2} \left (\frac {2 b^2 \left (12 a^2 B+8 a A b+b^2 B\right ) \text {arctanh}(\sin (c+d x))}{d}+2 a^2 x \left (a^2 A+8 a b B+12 A b^2\right )-\frac {2 b \left (4 a^3 B+13 a^2 A b-8 a b^2 B-2 A b^3\right ) \tan (c+d x)}{d}\right )+\frac {a (2 a B+5 A b) \sin (c+d x) (a+b \sec (c+d x))^2}{d}\right )+\frac {a A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d}\)

input
Int[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x]),x]
 
output
(a*A*Cos[c + d*x]*(a + b*Sec[c + d*x])^3*Sin[c + d*x])/(2*d) + ((a*(5*A*b 
+ 2*a*B)*(a + b*Sec[c + d*x])^2*Sin[c + d*x])/d - (b^2*(6*a*A*b + 2*a^2*B 
- b^2*B)*Sec[c + d*x]*Tan[c + d*x])/d + (2*a^2*(a^2*A + 12*A*b^2 + 8*a*b*B 
)*x + (2*b^2*(8*a*A*b + 12*a^2*B + b^2*B)*ArcTanh[Sin[c + d*x]])/d - (2*b* 
(13*a^2*A*b - 2*A*b^3 + 4*a^3*B - 8*a*b^2*B)*Tan[c + d*x])/d)/2)/2
 

3.4.6.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4513
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[a*A*Cot 
[e + f*x]*(a + b*Csc[e + f*x])^(m - 1)*((d*Csc[e + f*x])^n/(f*n)), x] + Sim 
p[1/(d*n)   Int[(a + b*Csc[e + f*x])^(m - 2)*(d*Csc[e + f*x])^(n + 1)*Simp[ 
a*(a*B*n - A*b*(m - n - 1)) + (2*a*b*B*n + A*(b^2*n + a^2*(1 + n)))*Csc[e + 
 f*x] + b*(b*B*n + a*A*(m + n))*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, 
d, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] & 
& LeQ[n, -1]
 

rule 4536
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. 
))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(-b)*C*Csc[e + 
 f*x]*(Cot[e + f*x]/(2*f)), x] + Simp[1/2   Int[Simp[2*A*a + (2*B*a + b*(2* 
A + C))*Csc[e + f*x] + 2*(a*C + B*b)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a 
, b, e, f, A, B, C}, x]
 

rule 4582
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. 
))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a 
_))^(m_), x_Symbol] :> Simp[A*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e 
 + f*x])^n/(f*n)), x] - Simp[1/(d*n)   Int[(a + b*Csc[e + f*x])^(m - 1)*(d* 
Csc[e + f*x])^(n + 1)*Simp[A*b*m - a*B*n - (b*B*n + a*(C*n + A*(n + 1)))*Cs 
c[e + f*x] - b*(C*n + A*(m + n + 1))*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a 
, b, d, e, f, A, B, C}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 0] && LeQ[n, -1]
 
3.4.6.4 Maple [A] (verified)

Time = 2.75 (sec) , antiderivative size = 187, normalized size of antiderivative = 0.89

method result size
derivativedivides \(\frac {a^{4} A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \,a^{4} \sin \left (d x +c \right )+4 A \,a^{3} b \sin \left (d x +c \right )+4 B \,a^{3} b \left (d x +c \right )+6 A \,a^{2} b^{2} \left (d x +c \right )+6 B \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 A a \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 B \tan \left (d x +c \right ) a \,b^{3}+A \tan \left (d x +c \right ) b^{4}+B \,b^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}\) \(187\)
default \(\frac {a^{4} A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \,a^{4} \sin \left (d x +c \right )+4 A \,a^{3} b \sin \left (d x +c \right )+4 B \,a^{3} b \left (d x +c \right )+6 A \,a^{2} b^{2} \left (d x +c \right )+6 B \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 A a \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+4 B \tan \left (d x +c \right ) a \,b^{3}+A \tan \left (d x +c \right ) b^{4}+B \,b^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}\) \(187\)
parallelrisch \(\frac {-32 b^{2} \left (1+\cos \left (2 d x +2 c \right )\right ) \left (A a b +\frac {3}{2} B \,a^{2}+\frac {1}{8} b^{2} B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+32 b^{2} \left (1+\cos \left (2 d x +2 c \right )\right ) \left (A a b +\frac {3}{2} B \,a^{2}+\frac {1}{8} b^{2} B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+4 a^{2} d x \left (A \,a^{2}+12 A \,b^{2}+8 B a b \right ) \cos \left (2 d x +2 c \right )+2 \left (a^{4} A +4 A \,b^{4}+16 B a \,b^{3}\right ) \sin \left (2 d x +2 c \right )+4 \left (4 A \,a^{3} b +B \,a^{4}\right ) \sin \left (3 d x +3 c \right )+a^{4} A \sin \left (4 d x +4 c \right )+4 \left (4 A \,a^{3} b +B \,a^{4}+2 B \,b^{4}\right ) \sin \left (d x +c \right )+4 a^{2} d x \left (A \,a^{2}+12 A \,b^{2}+8 B a b \right )}{8 d \left (1+\cos \left (2 d x +2 c \right )\right )}\) \(262\)
risch \(\frac {a^{4} A x}{2}+6 A \,a^{2} b^{2} x +4 B \,a^{3} b x -\frac {i b^{3} \left (B b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 A b \,{\mathrm e}^{2 i \left (d x +c \right )}-8 B a \,{\mathrm e}^{2 i \left (d x +c \right )}-B b \,{\mathrm e}^{i \left (d x +c \right )}-2 A b -8 B a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {2 i {\mathrm e}^{-i \left (d x +c \right )} A \,a^{3} b}{d}+\frac {i a^{4} A \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}-\frac {i a^{4} A \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 d}-\frac {2 i {\mathrm e}^{i \left (d x +c \right )} A \,a^{3} b}{d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B \,a^{4}}{2 d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B \,a^{4}}{2 d}-\frac {4 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A a \,b^{3}}{d}-\frac {6 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,a^{2} b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,b^{4}}{2 d}+\frac {4 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A a \,b^{3}}{d}+\frac {6 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,a^{2} b^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,b^{4}}{2 d}\) \(365\)
norman \(\frac {\left (\frac {1}{2} a^{4} A +6 A \,a^{2} b^{2}+4 B \,a^{3} b \right ) x +\left (-\frac {1}{2} a^{4} A -6 A \,a^{2} b^{2}-4 B \,a^{3} b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (-\frac {1}{2} a^{4} A -6 A \,a^{2} b^{2}-4 B \,a^{3} b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (\frac {1}{2} a^{4} A +6 A \,a^{2} b^{2}+4 B \,a^{3} b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{12}+\left (-a^{4} A -12 A \,a^{2} b^{2}-8 B \,a^{3} b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (-a^{4} A -12 A \,a^{2} b^{2}-8 B \,a^{3} b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (2 a^{4} A +24 A \,a^{2} b^{2}+16 B \,a^{3} b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {\left (a^{4} A +8 A \,a^{3} b +2 A \,b^{4}+2 B \,a^{4}+8 B a \,b^{3}+B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {\left (5 a^{4} A -24 A \,a^{3} b +2 A \,b^{4}-6 B \,a^{4}+8 B a \,b^{3}+B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}-\frac {\left (a^{4} A -8 A \,a^{3} b +2 A \,b^{4}-2 B \,a^{4}+8 B a \,b^{3}-B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{11}}{d}-\frac {2 \left (5 a^{4} A -8 A \,a^{3} b -2 A \,b^{4}-2 B \,a^{4}-8 B a \,b^{3}+B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}+\frac {2 \left (5 a^{4} A +8 A \,a^{3} b -2 A \,b^{4}+2 B \,a^{4}-8 B a \,b^{3}-B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {\left (5 a^{4} A +24 A \,a^{3} b +2 A \,b^{4}+6 B \,a^{4}+8 B a \,b^{3}-B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{4}}-\frac {b^{2} \left (8 A a b +12 B \,a^{2}+b^{2} B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {b^{2} \left (8 A a b +12 B \,a^{2}+b^{2} B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(670\)

input
int(cos(d*x+c)^2*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x,method=_RETURNVERBO 
SE)
 
output
1/d*(a^4*A*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+B*a^4*sin(d*x+c)+4*A* 
a^3*b*sin(d*x+c)+4*B*a^3*b*(d*x+c)+6*A*a^2*b^2*(d*x+c)+6*B*a^2*b^2*ln(sec( 
d*x+c)+tan(d*x+c))+4*A*a*b^3*ln(sec(d*x+c)+tan(d*x+c))+4*B*tan(d*x+c)*a*b^ 
3+A*tan(d*x+c)*b^4+B*b^4*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d*x+c)+tan( 
d*x+c))))
 
3.4.6.5 Fricas [A] (verification not implemented)

Time = 0.31 (sec) , antiderivative size = 202, normalized size of antiderivative = 0.97 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {2 \, {\left (A a^{4} + 8 \, B a^{3} b + 12 \, A a^{2} b^{2}\right )} d x \cos \left (d x + c\right )^{2} + {\left (12 \, B a^{2} b^{2} + 8 \, A a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (12 \, B a^{2} b^{2} + 8 \, A a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (A a^{4} \cos \left (d x + c\right )^{3} + B b^{4} + 2 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \]

input
integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="f 
ricas")
 
output
1/4*(2*(A*a^4 + 8*B*a^3*b + 12*A*a^2*b^2)*d*x*cos(d*x + c)^2 + (12*B*a^2*b 
^2 + 8*A*a*b^3 + B*b^4)*cos(d*x + c)^2*log(sin(d*x + c) + 1) - (12*B*a^2*b 
^2 + 8*A*a*b^3 + B*b^4)*cos(d*x + c)^2*log(-sin(d*x + c) + 1) + 2*(A*a^4*c 
os(d*x + c)^3 + B*b^4 + 2*(B*a^4 + 4*A*a^3*b)*cos(d*x + c)^2 + 2*(4*B*a*b^ 
3 + A*b^4)*cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c)^2)
 
3.4.6.6 Sympy [F]

\[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{4} \cos ^{2}{\left (c + d x \right )}\, dx \]

input
integrate(cos(d*x+c)**2*(a+b*sec(d*x+c))**4*(A+B*sec(d*x+c)),x)
 
output
Integral((A + B*sec(c + d*x))*(a + b*sec(c + d*x))**4*cos(c + d*x)**2, x)
 
3.4.6.7 Maxima [A] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.00 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{4} + 16 \, {\left (d x + c\right )} B a^{3} b + 24 \, {\left (d x + c\right )} A a^{2} b^{2} - B b^{4} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, B a^{2} b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 8 \, A a b^{3} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{4} \sin \left (d x + c\right ) + 16 \, A a^{3} b \sin \left (d x + c\right ) + 16 \, B a b^{3} \tan \left (d x + c\right ) + 4 \, A b^{4} \tan \left (d x + c\right )}{4 \, d} \]

input
integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="m 
axima")
 
output
1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*A*a^4 + 16*(d*x + c)*B*a^3*b + 24*(d 
*x + c)*A*a^2*b^2 - B*b^4*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d 
*x + c) + 1) + log(sin(d*x + c) - 1)) + 12*B*a^2*b^2*(log(sin(d*x + c) + 1 
) - log(sin(d*x + c) - 1)) + 8*A*a*b^3*(log(sin(d*x + c) + 1) - log(sin(d* 
x + c) - 1)) + 4*B*a^4*sin(d*x + c) + 16*A*a^3*b*sin(d*x + c) + 16*B*a*b^3 
*tan(d*x + c) + 4*A*b^4*tan(d*x + c))/d
 
3.4.6.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 528 vs. \(2 (197) = 394\).

Time = 0.36 (sec) , antiderivative size = 528, normalized size of antiderivative = 2.53 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {{\left (A a^{4} + 8 \, B a^{3} b + 12 \, A a^{2} b^{2}\right )} {\left (d x + c\right )} + {\left (12 \, B a^{2} b^{2} + 8 \, A a b^{3} + B b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (12 \, B a^{2} b^{2} + 8 \, A a b^{3} + B b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 2 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 8 \, A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 8 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 2 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 3 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 2 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 8 \, A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 8 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 2 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 8 \, A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 8 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 8 \, A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 8 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1\right )}^{2}}}{2 \, d} \]

input
integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="g 
iac")
 
output
1/2*((A*a^4 + 8*B*a^3*b + 12*A*a^2*b^2)*(d*x + c) + (12*B*a^2*b^2 + 8*A*a* 
b^3 + B*b^4)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - (12*B*a^2*b^2 + 8*A*a*b^ 
3 + B*b^4)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*(A*a^4*tan(1/2*d*x + 1/2 
*c)^7 - 2*B*a^4*tan(1/2*d*x + 1/2*c)^7 - 8*A*a^3*b*tan(1/2*d*x + 1/2*c)^7 
+ 8*B*a*b^3*tan(1/2*d*x + 1/2*c)^7 + 2*A*b^4*tan(1/2*d*x + 1/2*c)^7 - B*b^ 
4*tan(1/2*d*x + 1/2*c)^7 - 3*A*a^4*tan(1/2*d*x + 1/2*c)^5 + 2*B*a^4*tan(1/ 
2*d*x + 1/2*c)^5 + 8*A*a^3*b*tan(1/2*d*x + 1/2*c)^5 + 8*B*a*b^3*tan(1/2*d* 
x + 1/2*c)^5 + 2*A*b^4*tan(1/2*d*x + 1/2*c)^5 - 3*B*b^4*tan(1/2*d*x + 1/2* 
c)^5 + 3*A*a^4*tan(1/2*d*x + 1/2*c)^3 + 2*B*a^4*tan(1/2*d*x + 1/2*c)^3 + 8 
*A*a^3*b*tan(1/2*d*x + 1/2*c)^3 - 8*B*a*b^3*tan(1/2*d*x + 1/2*c)^3 - 2*A*b 
^4*tan(1/2*d*x + 1/2*c)^3 - 3*B*b^4*tan(1/2*d*x + 1/2*c)^3 - A*a^4*tan(1/2 
*d*x + 1/2*c) - 2*B*a^4*tan(1/2*d*x + 1/2*c) - 8*A*a^3*b*tan(1/2*d*x + 1/2 
*c) - 8*B*a*b^3*tan(1/2*d*x + 1/2*c) - 2*A*b^4*tan(1/2*d*x + 1/2*c) - B*b^ 
4*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^4 - 1)^2)/d
 
3.4.6.9 Mupad [B] (verification not implemented)

Time = 16.76 (sec) , antiderivative size = 330, normalized size of antiderivative = 1.58 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {2\,\left (\frac {A\,a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+\frac {B\,b^4\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+4\,A\,a\,b^3\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+4\,B\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+6\,A\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+6\,B\,a^2\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\right )}{d}+\frac {\frac {A\,a^4\,\sin \left (2\,c+2\,d\,x\right )}{8}+\frac {A\,a^4\,\sin \left (4\,c+4\,d\,x\right )}{16}+\frac {A\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {B\,a^4\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {B\,a^4\,\sin \left (c+d\,x\right )}{4}+\frac {B\,b^4\,\sin \left (c+d\,x\right )}{2}+A\,a^3\,b\,\sin \left (c+d\,x\right )+A\,a^3\,b\,\sin \left (3\,c+3\,d\,x\right )+2\,B\,a\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )} \]

input
int(cos(c + d*x)^2*(A + B/cos(c + d*x))*(a + b/cos(c + d*x))^4,x)
 
output
(2*((A*a^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/2 + (B*b^4*atanh(s 
in(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/2 + 4*A*a*b^3*atanh(sin(c/2 + (d*x) 
/2)/cos(c/2 + (d*x)/2)) + 4*B*a^3*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x 
)/2)) + 6*A*a^2*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) + 6*B*a^2* 
b^2*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))))/d + ((A*a^4*sin(2*c + 2 
*d*x))/8 + (A*a^4*sin(4*c + 4*d*x))/16 + (A*b^4*sin(2*c + 2*d*x))/2 + (B*a 
^4*sin(3*c + 3*d*x))/4 + (B*a^4*sin(c + d*x))/4 + (B*b^4*sin(c + d*x))/2 + 
 A*a^3*b*sin(c + d*x) + A*a^3*b*sin(3*c + 3*d*x) + 2*B*a*b^3*sin(2*c + 2*d 
*x))/(d*(cos(2*c + 2*d*x)/2 + 1/2))